package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 订单
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_order`", autoResultMap = true)
public class LyOrder {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @NotNull
    @ApiModelProperty("用户表的用户ID")
    @TableField(value = "`user_id`")
    private Integer userId;


    @Length(max = 63, message = "订单编号长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("订单编号")
    @TableField(value = "`order_sn`")
    private String orderSn;


    @NotNull
    @ApiModelProperty("订单状态")
    @TableField(value = "`order_status`")
    private Integer orderStatus;


    @Length(max = 63, message = "收货人名称长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("收货人名称")
    @TableField(value = "`consignee`")
    private String consignee;


    @Length(max = 63, message = "收货人手机号长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("收货人手机号")
    @TableField(value = "`mobile`")
    private String mobile;


    @Length(max = 127, message = "收货具体地址长度不能超过127位")
    @NotEmpty
    @ApiModelProperty("收货具体地址")
    @TableField(value = "`address`")
    private String address;


    @Length(max = 512, message = "用户订单留言长度不能超过512位")
    @NotEmpty
    @ApiModelProperty("用户订单留言")
    @TableField(value = "`message`")
    private String message;


    @Digits(integer = 10 - 2, fraction = 2)
    @NotNull
    @ApiModelProperty("商品总费用")
    @TableField(value = "`goods_price`")
    private BigDecimal goodsPrice;


    @Digits(integer = 10 - 2, fraction = 2)
    @ApiModelProperty("配送费用")
    @TableField(value = "`freight_price`")
    private BigDecimal freightPrice;


    @Digits(integer = 10 - 2, fraction = 2)
    @NotNull
    @ApiModelProperty("优惠券减免")
    @TableField(value = "`coupon_price`")
    private BigDecimal couponPrice;


    @Digits(integer = 10 - 2, fraction = 2)
    @NotNull
    @ApiModelProperty("用户积分减免")
    @TableField(value = "`integral_price`")
    private BigDecimal integralPrice;


    @Digits(integer = 10 - 2, fraction = 2)
    @NotNull
    @ApiModelProperty("团购优惠价减免")
    @TableField(value = "`groupon_price`")
    private BigDecimal grouponPrice;


    @Digits(integer = 10 - 2, fraction = 2)
    @NotNull
    @ApiModelProperty("订单费用， = goods_price + freight_price - coupon_price")
    @TableField(value = "`order_price`")
    private BigDecimal orderPrice;


    @Digits(integer = 10 - 2, fraction = 2)
    @NotNull
    @ApiModelProperty("实付费用， = order_price - integral_price")
    @TableField(value = "`actual_price`")
    private BigDecimal actualPrice;


    @Length(max = 63, message = "微信付款编号长度不能超过63位")
    @ApiModelProperty("微信付款编号")
    @TableField(value = "`pay_id`")
    private String payId;


    @ApiModelProperty("微信付款时间")
    @TableField(value = "`pay_time`")
    private LocalDateTime payTime;


    @Length(max = 63, message = "发货编号长度不能超过63位")
    @ApiModelProperty("发货编号")
    @TableField(value = "`ship_sn`")
    private String shipSn;


    @Length(max = 63, message = "发货快递公司长度不能超过63位")
    @ApiModelProperty("发货快递公司")
    @TableField(value = "`ship_channel`")
    private String shipChannel;


    @ApiModelProperty("发货开始时间")
    @TableField(value = "`ship_time`")
    private LocalDateTime shipTime;


    @ApiModelProperty("用户确认收货时间")
    @TableField(value = "`confirm_time`")
    private LocalDateTime confirmTime;


    @ApiModelProperty("待评价订单商品数量")
    @TableField(value = "`comments`")
    private Integer comments;


    @ApiModelProperty("订单关闭时间")
    @TableField(value = "`end_time`")
    private LocalDateTime endTime;


    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;


    @Digits(integer = 10 - 2, fraction = 2)
    @ApiModelProperty("代理结算金额")
    @TableField(value = "`settlement_money`")
    private BigDecimal settlementMoney;


    @NotNull
    @ApiModelProperty("结算状态")
    @TableField(value = "`settlement_status`")
    private Integer settlementStatus;


    @NotNull
    @ApiModelProperty("配送方式 ：0 快递, 1 自提")
    @TableField(value = "`freight_type`")
    private Integer freightType;


    @ApiModelProperty("分数")
    @TableField(value = "`fraction`")
    private Integer fraction;


    @Length(max = 12, message = "提货码长度不能超过12位")
    @ApiModelProperty("提货码")
    @TableField(value = "`fetch_code`")
    private String fetchCode;


    @ApiModelProperty("原始创建人")
    @TableField(value = "`create_user_id`")
    private Integer createUserId;


    @ApiModelProperty("转赠发送时间")
    @TableField(value = "`gift_send_time`")
    private LocalDateTime giftSendTime;


    @ApiModelProperty("转赠接收时间")
    @TableField(value = "`gift_receive_time`")
    private LocalDateTime giftReceiveTime;

}
